# -*- coding: UTF-8 -*-
from roles.rolesDAO import userDAO
<<<<<<< HEAD
"""
leftMenuBtnsCommon = (
                   {'key':'allworkflow',        'name':'查看历史工单',     'url':'/allworkflow/',              'class':'glyphicon glyphicon-home'},
                   {'key':'submitsql',          'name':'发起SQL上线',       'url':'/submitsql/',               'class':'glyphicon glyphicon-asterisk'},
               )
leftMenuBtnsSuper = (
                   {'key':'masterconfig',       'name':'主库地址配置',      'url':'/admin/sql/master_config/',      'class':'glyphicon glyphicon-user'},
                   {'key':'userconfig',         'name':'用户权限配置',       'url':'/admin/sql/users/',        'class':'glyphicon glyphicon-th-large'},
                   {'key':'workflowconfig',     'name':'所有工单管理',       'url':'/admin/sql/workflow/',        'class':'glyphicon glyphicon-list-alt'},
)
leftMenuBtnsDoc = (
                   {'key':'dbaprinciples',     'name':'SQL审核必读',       'url':'/dbaprinciples/',        'class':'glyphicon glyphicon-book'},
                   {'key':'charts',     'name':'统计图表展示',       'url':'/charts/',        'class':'glyphicon glyphicon-file'},
)
"""
=======

>>>>>>> 03b0cbb3079f9b560266e5d23952e075f9348e64
rolesDao = userDAO()

def global_info(request):

    """存放用户，会话信息等."""
    loginUser = request.session.get('login_username', None)
<<<<<<< HEAD
    print("global_processor.loginUser="+loginUser)
    if loginUser is not None:
        user = rolesDao.getUserInfo(loginUser)
        leftMenuBtns = rolesDao.getUserLeftMenu(user['groupId'])
        print("leftMenuBtns="+str(leftMenuBtns))
=======
    acccessUrl = request.path
    print("acccessUrl="+acccessUrl)
    if loginUser is not None:
        user = rolesDao.getUserInfo(loginUser)
        leftMenuBtns = rolesDao.getUserLeftMenu(user['groupId'])
>>>>>>> 03b0cbb3079f9b560266e5d23952e075f9348e64
    else:
        leftMenuBtns = ()
        print("leftMenuBtns="+str(leftMenuBtns))

    return {
        'loginUser':loginUser,
        'leftMenuBtns':leftMenuBtns,
    }